package com.smartcanteen.user.mapper;


import com.smartcanteen.user.domain.entity.User;
import com.smartcanteen.user.domain.vo.MerchantVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

@Mapper
public interface UserMapper {

    @Select("select * from sc_user where openid = #{openid}")
    User getByOpenid(String openid);

    void insert(User user);

    @Select("select * from sc_user where id = #{id}")
    User getById(Integer id);

    void update(User user);

    Integer countByMap(Map map);
    User selectByAccountAndPassword(@Param("account")String account, @Param("password")String password);

    @Select("SELECT d.dept_name,u.user_name FROM sys_user u JOIN sys_dept d ON u.dept_id = d.dept_id WHERE u.user_id = #{id}")
    MerchantVO getMerchant(@Param("id") Integer id);
}
